<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Tableau de bord du gestionnaire de l'hotel</title>
        <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
    </head>
    <body>
        <f:view>
            <h:form>
                <h:panelGroup rendered="#{LoginBean.gestionnaire.idGestionnaireHotel == null}">
                    <h:outputText styleClass="error" value="Veuillez vous "/><a href="faces/Login.jsp">identifier</a> <h:outputText styleClass="error" value=" ou "/><a href="faces/InscriptionGestHotel.jsp">Inscrivez vous</a>
                </h:panelGroup>
                
                <h:panelGroup rendered="#{LoginBean.gestionnaire.idGestionnaireHotel != null}">
                    <h1>Tableau de bord gestionnaire d'hotel</h1>
                    <h:messages id="erreur" errorClass="error" infoClass="confirm"/>
                    <h:commandButton action="goToProfil" value="Modifier mon profil" />
                    
                    <h3>Mes hotels</h3>  
                    
                    <h:commandButton value="Ajouter un hotel" action="#{TdbGestionnaireBean.ajoutHotel}" />
                    
                    <h:dataTable value="#{TdbGestionnaireBean.listeSelectHotel}" var="hotel" >
                        
                        <h:column>
                            <f:facet name="header"><f:verbatim>Hotel</f:verbatim></f:facet>
                            <h:outputText value="#{hotel.nom}"></h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header"><f:verbatim>Ville</f:verbatim></f:facet>
                            <h:outputText value="#{hotel.ville.nom}"></h:outputText>
                        </h:column>
                         <h:column>
                            <f:facet name="header"><f:verbatim>Nombre de chambre</f:verbatim></f:facet>
                            <h:outputText value="#{fn:length(hotel.chambreCollection)}"></h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header"><f:verbatim>Actions</f:verbatim></f:facet>
                            <h:commandButton id="btnEdite" value="Modifier" action="#{TdbGestionnaireBean.editer}" immediate="true"/>
                            <h:commandButton action="#{TdbGestionnaireBean.supprimer}" value="Supprimer"/>
                            
                        </h:column>
                        
                    </h:dataTable>
                    
                    <h:commandButton action="Planning" value="Consulter les reservations"/>
                    
                </h:panelGroup>
            </h:form>
        </f:view>
    </body>
</html>
